#include "bing.h"

#include <request.h>

Bing::Bing(Lang lang) : m_lang(lang) {}

QString Bing::name()
{
    return QString("Bing - ") + (m_lang == ZH ? "中文版" : "英文版" );
}

QString Bing::content(const QString &text)
{
    Request req("https://www.bing.com/search");
    if (m_lang == ZH) {
        req.addQuery("mkt", "zh-CN");
    } else {
        req.addQuery("mkt", "en-us");
    }
    req.addQuery("q", text.isEmpty() ? "Bing" : text);
    return req.queryUrl().toString();
}

